<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>提现管理</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link rel="stylesheet" href="js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
    <!--时间选择插件-->
    <link rel="stylesheet" href="js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
    <!--日期选择插件-->
    <link rel="stylesheet" href="js/bootstrap-datepicker/bootstrap-datepicker3.min.css">
    <link href="css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">

                    <div id="toolbar" class="toolbar-btn-action">
                        <form class="form-inline" method="post" id="searchForm">
                            <div class="form-group">
                                <label>账号:</label>
                                <input type="text" class="form-control" name="businessId">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info btn_query btn-round" type="button" id="searchFormBtn">查询</button>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-warning btn_query btn-round" type="button" id="passReview">审核</button>
                            </div>
                        </form>
                    </div>

                </div>
                <div class="card-body">

                    <table id="grid_data"></table>

                </div>
            </div>
        </div>
    </div>

    <!--  添加与编辑模态框 -->
    <div class="modal fade" id="addOrEditModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">提现审核</h4>
                </div>
                <div class="modal-body">
                    <form id="addOrEditForm"  method="post" data-target="validator">
                        <div class="form-group">
                            <label class="control-label">审核状态：</label>
                            <input type="hidden" name="id" id="id">
                            <input type="hidden" name="businessId" id="businessId">
                            <input type="hidden" name="businessType" id="businessType">
                            <input type="hidden" name="orderNum" id="orderNum">
                            <input type="hidden" name="storeName" id="storeName">
                            <input type="hidden" name="aplipayAccount" id="aplipayAccount">
                            <input type="hidden" name="name" id="name">
                            <input type="hidden" name="bankName" id="bankName">
                            <input type="hidden" name="bankTypeName" id="bankTypeName">
                            <input type="hidden" name="cardNum" id="cardNum">
                            <input type="hidden" name="bankType" id="bankType">
                            <input type="hidden" name="price" id="price">
                            <input type="hidden" name="money" id="money">
                            <input type="hidden" name="billie" id="billie">
                            <input type="hidden" name="createDate" id="createDate">
                            <input type="hidden" name="withdrawalType" id="withdrawalType">
                            <input type="hidden" name="remarks" id="remarks">
                            <div>
                                <label class="checkbox-inline i-checks"> <input type="radio" name="state" value="1"/>审核通过</label>
                                <label class="checkbox-inline i-checks"> <input type="radio" name="state" value="2"/>审核不通过</label>
                            </div>
                        </div>

                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="button" class="btn btn-primary" id="sava">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
    <script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
    <!-- bootstrap表单验证插件 -->
    <script type="text/javascript" src="js/bootstrap-validator-master/dist/validator.js"></script>
    <!-- jquery-form表单提交插件 -->
    <script type="text/javascript" src="js/jquery-form/jquery.form.js"></script>
    <!-- bootstrap弹出框插件 -->
    <script type="text/javascript" src="js/jquery.bootstrap.min.js"></script>
    <!-- 表单填充插件 -->
    <script type="text/javascript" src="js/jquery-form/jquery.formloader.js"></script>
    <!--时间选择插件-->
    <script src="js/bootstrap-datetimepicker/moment.min.js"></script>
    <script src="js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
    <!--日期选择插件-->
    <script src="js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
    <script src="js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <script type="text/javascript" src="js/main.min.js"></script>
    <script type="text/javascript">

        //设置表头
        var columns = [
            {checkbox: true},
            {field: 'businessId',title: '商家Id'},
            {field: 'businessType',title: '商家类型',formatter: function (value, row, index) {
                    if (value=='0') {
                         return "合作商家";
                    }else if(value=='1'){
                        return "联盟商家";
                    }else if(value=='2'){
                        return "联盟企业";
                    }}},
            {field: 'orderNum',title: '提现订单号'},
            {field: 'storeName',title: '店铺名称'},
            {field: 'aplipayAccount',title: '支付宝账号'},
            {field: 'name',title: '支付宝姓名'},
            {field: 'bankName',title: '银行卡姓名',visible:false},
            {field: 'cardNum',title: '银行卡号',visible:false},
            {field: 'bankType',title: '银行卡编码',visible:false},
            {field: 'bankTypeName',title: '银行卡名称',visible:false},
            {field: 'createDate',title: '申请提现时间', formatter: function (value) {
                    return zero2one.dateFormat(value, 'Y-m-d H:i:s')
                }},
            {field: 'price',title: '提取金额',formatter: function (value) {
                    return value + '元';
                }},
            {field: 'money',title: '比例后的金额',formatter: function (value) {
                    return value + '元';
                }},
            {field: 'billie',title: '比例',formatter: function (value) {
                    return value + '%';
            }},
            {field: 'withdrawalType',title: '提现类型',formatter: function (value, row, index) {
                    if (value=='0') {
                        return "支付宝";
                    }else if(value=='1'){
                        return "银行卡";
                    }}},
            {field: 'state',title: '审核状态',formatter: function (value, row, index) {
                    if (value=='0') {
                        return "审核中";
                    }else if(value=='1'){
                        return "审核通过";
                    }else if(value=='2'){
                        return "审核不通过";
                    }}},
            {field: 'userId',title: '审核人名字'},
        ];

        //进入主界面加载数据
        zero2one.datagrid("grid_data", "/remote/tcWithdrawal/tcWithdrawalPage",function (params) {
            return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
        }, columns);

        //点击查询按钮重新加载页面数据
        $("#searchFormBtn").click(function () {
            $('#grid_data').bootstrapTable('refresh');
        });

        //点击编辑按钮弹出模态框
        $("#passReview").click(function () {
            //获取选中行的数据
            var datas = $('#grid_data').bootstrapTable('getSelections');
            //判断是否选中行数据，如果没有则提示
            if(datas.length>0&&datas[0].state==0){
                $("#addOrEditForm").formloader({data: datas[0]});
                $("#addOrEditModal").modal("show");
            }else if(datas.length>0&&datas[0].state==1){
                $.messager.alert("温馨提示", "审核通过数据无法操作");

            }else{
                $.messager.alert("温馨提示", "请选择一条操作");

            }

        });

        //保存按钮的点击事件
        $("#sava").click(function () {
            zero2one.request("/remote/tcWithdrawal/reviewStatus",$("#addOrEditForm").serialize(),function (data) {
                if (data.success) {
                    window.location.reload();
                }else {
                    $.messager.alert("温馨提示", data.msg)
                }
            });

        });

    </script>

</div>
</body>
</html>
